<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app">
        <App></App>
        <Count></Count>

    </div>
    <script>
        Vue.config.productionTip = false;

        // 1.使用Vue.extend({})创建组件
        // 组件都是独立的
        const App = Vue.extend({
            template: `
          <div>
            <h1>App组件</h1> 
            <button @click="show">show</button>
          </div>
        `,
        methods: {
           show(){
            console.log(this.$bus);
           }
        },
        });

        const Count = Vue.extend({
            template: `
          <div>
            <h1>Count组件</h1> 
            <button @click="show">show</button>
          </div>
        `,
        methods:{
            show(){
                console.log(this.$bus);
            console.log(this); //组件实例化对象
            console.log(this.__proto__, "this.__proto__"); //VueComponent.proptype
            console.log(this.__proto__.__proto__, "this.__proto__.__proto__ "); //Vue.prototype
            console.log(
              this.__proto__.__proto__.__proto__, //Object.prototype
              "this.__proto__.__proto__.__proto__ "
            );
            console.log(
              this.__proto__.__proto__.__proto__.__proto__, //null
              "this.__proto__.__proto__.__proto__.__proto__"
            );
            }
        }
        })
        
        
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    
                }
            },
            // 注册组件
            components:{
                App,
                Count,
            }
        })
        Vue.prototype.$bus = "1";
</script>
</body>

</html>